package com.futu.user.controller;

import com.futu.common.vo.ResultVo;
import com.futu.user.domain.YReserve;
import com.futu.user.dto.LoginDto;
import com.futu.user.dto.PhoneLoginDto;
import com.futu.user.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private UsersService userService;


    @PostMapping("login")
    public ResultVo login(@RequestBody LoginDto dto) throws InterruptedException {
        return userService.login(dto);
    }

    @PostMapping("loginAndRegister")
    public ResultVo loginAndRegister(String phone) {
        return userService.loginAndRegister(phone);
    }

    @PostMapping("phoneLogin")
    public ResultVo phoneLogin(@RequestBody PhoneLoginDto phoneLoginDto) throws InterruptedException {
        return userService.phoneLogin(phoneLoginDto);
    }

    @PostMapping("my")
    public ResultVo my(@RequestHeader String token)  {
        return userService.my(token);
    }

    @PostMapping("Reserve")
    public ResultVo Reserve(@RequestBody YReserve Reserve, @RequestHeader String token)  {
        return userService.Reserve(Reserve,token);
    }


}
